<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<div class="row">
	<div class="col-lg-10 mx-auto">
		<div class="card">
			<div class="card-body">
				<form action="<?php echo url("plugin-setting-xn_insert_code");?>" method="post" id="form">
					<h4 class="card-title">页脚</h4>
					<img src="../plugin/xn_insert_code/img/example1.png" class="img-fluid my-3" />
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">页面底部：</label>
						<div class="col-sm-10">
							<textarea name="footer_start_htm" class="w-100" style="height: 100px;"><?php echo $setting['footer_start_htm'];?></textarea>
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">页脚左侧：</label>
						<div class="col-sm-10">
							<textarea name="footer_footer_left_end_htm" class="w-100" style="height: 50px;" placeholder=" / 北京XX责任有限公司"><?php echo $setting['footer_footer_left_end_htm'];?></textarea>
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">页脚右侧：</label>
						<div class="col-sm-10">
							<textarea name="footer_footer_right_end_htm" class="w-100" style="height: 50px;" placeholder=" / ICP 备案 12345678"><?php echo $setting['footer_footer_right_end_htm'];?></textarea>
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">统计代码：</label>
						<div class="col-sm-10">
							<textarea name="footer_end_htm" class="w-100" style="height: 100px;"><?php echo $setting['footer_end_htm'];?></textarea>
							<span class="text-muted">注：一般放统计代码，建议采用异步加载提高速度，找到统计代码中的关键的 URL，然后引入：</span><br>
							<kbd>&lt;script&gt;$.require('https://hm.baidu.com/hm.js?38e521ad5fb62b974841a4e0b774566e');&lt;/script&gt;</kbd>
						</div>
					</div>
					
					<h4 class="card-title">首页</h4>
					
					<img src="../plugin/xn_insert_code/img/example2.png" class="img-fluid my-3" />
					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">首页头部：</label>
						<div class="col-sm-10">
							<textarea name="index_main_start_htm" class="w-100" style="height: 100px;" placeholder="&lt;div class=&quot;card&quot;&gt; ... &lt;/div&gt;"><?php echo $setting['index_main_start_htm'];?></textarea>
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">首页右侧：</label>
						<div class="col-sm-10">
							<textarea name="index_site_brief_after_htm" class="w-100" style="height: 100px;" placeholder="&lt;div class=&quot;card&quot;&gt; ... &lt;/div&gt;"><?php echo $setting['index_site_brief_after_htm'];?></textarea>
						</div>
					</div>
					
					<h4 class="card-title">详情页</h4>
					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">详情页右侧：</label>
						<div class="col-sm-10">
							<textarea name="thread_user_after_htm" class="w-100" style="height: 100px;" placeholder="&lt;div class=&quot;card&quot;&gt; ... &lt;/div&gt;"><?php echo $setting['thread_user_after_htm'];?></textarea>
						</div>
					</div>
					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"></label>
						<div class="col-sm-10">
							<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>..."><?php echo lang('confirm');?></button>
							<a role="button" class="btn btn-secondary btn-block mt-3" href="javascript:history.back();"><?php echo lang('back');?></a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>
var jform = $("#form");
var jsubmit = $("#submit");
var referer = '<?php echo http_referer();?>';
jform.on('submit', function(){
	jform.reset();
	jsubmit.button('loading');
	var postdata = jform.serialize();
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.text(message).delay(2000).button('reset').location(referer);
			return;
		} else {
			$.alert(message);
			jsubmit.button('reset');
		}
	});
	return false;
});
</script>